<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ page trimDirectiveWhitespaces="true"%>
<%@ taglib prefix="base" uri="http://qdbp.gitee.io/tags/base/"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>

<div class="x-layout" data-options="border:false,fit:true" style="width:100%;height:100%;">
	<div data-options="region:'west',border:false,split:true" style="width:200px;">
		<table class="x-treegrid left-datalist"
			data-options="fit:true,border:false,rownumbers:false,
			method:'POST',url:'<base:url href='actions/account-crud/mamager/dept/list.json' />',
			fixedParams:{ordering:'sortIndex asc, deptName asc'},
			prepend:{deptCode:'0',deptName:'根节点'},
			idField:'deptCode',parentField:'parentCode',treeField:'deptName',
			onClickRow:onClickRowOfDept,
			xextra:{fields:[{field:'Dept',key:'deptCode',value:'deptName',parent:'parentCode'}],map:{Dept:'body'}}">
			<thead>
				<tr>
					<th data-options="field:'deptName',width:199,align:'left',halign:'center'">部门名称</th>
				</tr>
			</thead>
		</table>
	</div>
	<div data-options="region:'center',border:false,iconCls:'icon-ok'">
		<table class="x-datagrid main-datalist"
				data-options="toolbar:'.toolbar-box',
				method:'POST',url:'<base:url href='actions/account-crud/mamager/list.json' />',
				fixedParams:{userType:'ADMIN',ordering:'createTime desc'<shiro:lacksPermission name="root:develop">,superman:false</shiro:lacksPermission>,userStates:['NORMAL','LOCKED']},
				eachCopy:[ {displayName:toDisplayName}, { roleIds:'extra.RoleIds.{id}', '{options}':{arrayToString:true} }],
				xextra:[{field:'Role',key:'id',value:'roleName'}]">
			<thead>
				<tr>
					<th data-options="field:'id',width:100,align:'center',checkbox:true">选择</th>
					<th data-options="field:'userCode',width:100,align:'center',xpopup:'update',xoptions:{iconCls:'fa fa-pencil'}">账号</th>
					<th data-options="field:'nickName',width:120,align:'center'">昵称</th>
					<th data-options="field:'realName',width:80,align:'center'">真实姓名</th>
					<th data-options="field:'gender',width:45,align:'center',xextra:{field:'Gender',ignore:'UNKNOWN'}">性别</th>
					<th data-options="field:'phone',width:100,align:'center'">电话</th>
					<th data-options="field:'email',width:150,align:'center'">邮箱</th>
					<th data-options="field:'deptCode',width:100,align:'center',xextra:'Dept'">部门</th>
					<th data-options="field:'roleIds',width:150,align:'center',xextra:'Role'">角色</th>
					<th data-options="field:'createTime',width:150,align:'center'">创建时间</th>
					<th data-options="field:'userState',width:45,align:'center',xextra:'UserState'">状态</th>
			</tr>
		</thead>
	</table>
	</div>
</div>

<div class="hide">
	<div class="x-dialog container-fluid" title="详情" data-options="xpopup:'details',width:500,modal:true,iconCls:'fa fa-file-text-o'">
		<form class="pure-box form-horizontal">
			<dd>
				<input type="hidden" name="id" />
				<div class="spacer-right">
					<div class="form-group">
						<div class="col-md-3 control-label">账号</div>
						<div class="col-md-9 control-input"><input class="x-textbox" type="text" name="userCode" data-options="readonly:true"/></div>
					</div>
					<div class="form-group">
						<div class="col-md-3 control-label">昵称</div>
						<div class="col-md-9 control-input"><input class="x-textbox" type="text" name="nickName" data-options="readonly:true"/></div>
					</div>
					<div class="form-group">
						<div class="col-md-3 control-label">真实姓名</div>
						<div class="col-md-9 control-input"><input class="x-textbox" type="text" name="realName" data-options="readonly:true"/></div>
					</div>
					<div class="form-group">
						<div class="col-md-3 control-label">电话</div>
						<div class="col-md-9 control-input"><input class="x-textbox" type="text" name="phone" data-options="readonly:true"/></div>
					</div>
					<div class="form-group">
						<div class="col-md-3 control-label">邮箱</div>
						<div class="col-md-9 control-input"><input class="x-textbox" type="text" name="email" data-options="readonly:true"/></div>
					</div>
					<div class="form-group">
						<div class="col-md-3 control-label">部门</div>
						<div class="col-md-9 control-input"><input class="x-textbox" type="text" name="deptCode" data-options="readonly:true,xextra:'Dept'"/></div>
					</div>
					<div class="form-group">
						<div class="col-md-3 control-label">角色</div>
						<div class="col-md-9 control-input"><input class="x-textbox" type="text" name="roleIds" data-options="readonly:true,xextra:'Role'"/></div>
					</div>
					<div class="form-group">
						<div class="col-md-3 control-label">性别</div>
						<div class="col-md-9 control-input"><input class="x-textbox" type="text" name="gender" data-options="readonly:true,xextra:{field:'Gender',ignore:'UNKNOWN'}"/></div>
					</div>
					<div class="form-group">
						<div class="col-md-3 control-label">身份证</div>
						<div class="col-md-9 control-input"><input class="x-textbox" type="text" name="identity" data-options="readonly:true"/></div>
					</div>
					<div class="form-group">
						<div class="col-md-3 control-label">创建时间</div>
						<div class="col-md-9 control-input"><input class="x-textbox" type="text" name="createTime" data-options="readonly:true"/></div>
					</div>
					<div class="form-group">
						<div class="col-md-3 control-label">状态</div>
						<div class="col-md-9 control-input"><input class="x-textbox" type="text" name="userState" data-options="readonly:true,xextra:'UserState'"/></div>
					</div>
				</div>
			</dd>
		</form>
		<div class="dialog-button">
			<a href="javascript:void(0)" class="x-linkbutton" data-options="xaction:'close',iconCls:'fa fa-close'">取消</a>
		</div>
	</div>
	<div class="x-dialog container-fluid" title="创建" data-options="xpopup:'create',width:500,modal:true,iconCls:'fa fa-plus'">
		<form class="pure-box form-horizontal" method="POST" action="<base:url href='actions/account-crud/mamager/create.json'/>">
			<dd>
				<input type="hidden" name="userType" value="ADMIN" data-clear="false" />
				<div class="spacer-right">
					<div class="form-group">
						<div class="col-md-3 control-label"><i class="asterisk"></i>账号</div>
						<div class="col-md-9 control-input"><input class="x-textbox" type="text" name="userCode" data-options="required:true,validType:['userCode','rejectMobile','length[0,20]']"/></div>
					</div>
					<div class="form-group">
						<div class="col-md-3 control-label"><i class="asterisk"></i>密码</div>
						<div class="col-md-9 control-input"><input class="x-textbox" type="password" name="password" data-options="required:true,validType:'length[0,50]'"/></div>
					</div>
					<div class="form-group">
						<div class="col-md-3 control-label">昵称</div>
						<div class="col-md-9 control-input"><input class="x-textbox" type="text" name="nickName" data-options="validType:['illegalChar','length[0,20]']"/></div>
					</div>
					<div class="form-group">
						<div class="col-md-3 control-label">真实姓名</div>
						<div class="col-md-9 control-input"><input class="x-textbox" type="text" name="realName" data-options="validType:['illegalChar','length[0,20]']"/></div>
					</div>
					<div class="form-group">
						<div class="col-md-3 control-label">电话</div>
						<div class="col-md-9 control-input"><input class="x-textbox" type="text" name="phone" data-options="validType:'mobile'"/></div>
					</div>
					<div class="form-group">
						<div class="col-md-3 control-label">邮箱</div>
						<div class="col-md-9 control-input"><input class="x-textbox" type="text" name="email" data-options="validType:'email'"/></div>
					</div>
					<div class="form-group">
						<div class="col-md-3 control-label">部门</div>
						<div class="col-md-9 control-input"><input class="x-combotree" type="text" name="deptCode" data-options="editable:false,checkbox:true,xextra:{field:'Dept',prepend:{key:'0',value:'根节点'}}"/></div>
					</div>
					<div class="form-group">
						<div class="col-md-3 control-label">角色</div>
						<div class="col-md-9 control-input"><input class="x-combobox" type="text" name="roleIds" data-options="editable:false,xextra:'Role'"/></div>
					</div>
					<div class="form-group">
						<div class="col-md-3 control-label">性别</div>
						<div class="col-md-9 control-input"><input class="x-combobox" type="text" name="gender" data-options="editable:false,xextra:{field:'Gender',ignore:'UNKNOWN'}"/></div>
					</div>
					<div class="form-group">
						<div class="col-md-3 control-label">身份证</div>
						<div class="col-md-9 control-input"><input class="x-textbox" type="text" name="identity" data-options="validType:'idcard'"/></div>
					</div>
				</div>
			</dd>
		</form>
		<div class="dialog-button">
			<a href="javascript:void(0)" class="x-linkbutton" data-options="xaction:'submit',iconCls:'fa fa-save',closeOnSuccess:false,clearOnSuccess:true,message:'保存'">保存并继续</a>
			<a href="javascript:void(0)" class="x-linkbutton" data-options="xaction:'submit',iconCls:'fa fa-save'">保存</a>
			<a href="javascript:void(0)" class="x-linkbutton" data-options="xaction:'close',iconCls:'fa fa-close'">取消</a>
		</div>
	</div>

	<div class="x-dialog container-fluid" title="账号信息" data-options="xpopup:'update',width:500,modal:true,iconCls:'fa fa-pencil'">
		<form class="pure-box form-horizontal" method="POST" action="<base:url href='actions/account-crud/mamager/update.json'/>">
			<dd>
				<input type="hidden" name="id" />
				<div class="spacer-right">
					<div class="form-group">
						<div class="col-md-3 control-label"><i class="asterisk"></i>账号</div>
						<div class="col-md-9 control-input"><input class="x-textbox" type="text" name="userCode" data-options="required:true,validType:['userCode','rejectMobile','length[0,20]']"/></div>
					</div>
					<div class="form-group">
						<div class="col-md-3 control-label">昵称</div>
						<div class="col-md-9 control-input"><input class="x-textbox" type="text" name="nickName" data-options="validType:['illegalChar','length[0,20]']"/></div>
					</div>
					<div class="form-group">
						<div class="col-md-3 control-label">真实姓名</div>
						<div class="col-md-9 control-input"><input class="x-textbox" type="text" name="realName" data-options="validType:['illegalChar','length[0,20]']"/></div>
					</div>
					<div class="form-group">
						<div class="col-md-3 control-label">电话</div>
						<div class="col-md-9 control-input"><input class="x-textbox" type="text" name="phone" data-options="validType:'mobile'"/></div>
					</div>
					<div class="form-group">
						<div class="col-md-3 control-label">邮箱</div>
						<div class="col-md-9 control-input"><input class="x-textbox" type="text" name="email" data-options="validType:{email:true<%--,remote:['xx/check.json','email',['id'],'邮箱已被占用']--%>}"/></div>
					</div>
					<div class="form-group">
						<div class="col-md-3 control-label">部门</div>
						<div class="col-md-9 control-input"><input class="x-combotree" type="text" name="deptCode" data-options="editable:false,checkbox:true,xextra:{field:'Dept',prepend:{key:'0',value:'根节点'}}"/></div>
					</div>
					<div class="form-group">
						<div class="col-md-3 control-label">角色</div>
						<div class="col-md-9 control-input"><input class="x-combobox" type="text" name="roleIds" data-options="editable:false,multiple:true,xextra:'Role'"/></div>
					</div>
					<div class="form-group">
						<div class="col-md-3 control-label">性别</div>
						<div class="col-md-9 control-input"><input class="x-combobox" type="text" name="gender" data-options="editable:false,xextra:{field:'Gender'}"/></div>
					</div>
					<div class="form-group">
						<div class="col-md-3 control-label">身份证</div>
						<div class="col-md-9 control-input"><input class="x-textbox" type="text" name="identity" data-options="validType:'idcard'"/></div>
					</div>
				</div>
			</dd>
		</form>
		<div class="dialog-button">
			<shiro:hasPermission name="account-crud:mamager:update">
			<a href="javascript:void(0)" class="x-linkbutton" data-options="xaction:'submit',iconCls:'fa fa-save'">保存</a>
			</shiro:hasPermission>
			<a href="javascript:void(0)" class="x-linkbutton" data-options="xaction:'close',iconCls:'fa fa-close'">取消</a>
		</div>
	</div>
	<div class="x-dialog container-fluid" title="删除" data-options="xpopup:'delete',width:320,modal:true,iconCls:'fa fa-minus'">
		<form class="pure-box form-horizontal" method="POST" action="<base:url href='actions/account-crud/mamager/delete.json'/>">
			<dd>
				<span>确定要删除<abbr title="勾选指的是在第一列打勾，可以同时选中多行记录">勾选</abbr>的 <span class="records"></span> 条记录?</span>
			</dd>
		</form>
		<div class="dialog-button">
			<a href="javascript:void(0)" class="x-linkbutton" data-options="xaction:'submit',iconCls:'fa fa-check',message:'删除'">确定</a>
			<a href="javascript:void(0)" class="x-linkbutton" data-options="xaction:'close',iconCls:'fa fa-close'">取消</a>
		</div>
	</div>
	<div class="x-dialog container-fluid" title="解锁" data-options="xpopup:'enable',width:320,modal:true,iconCls:'fa fa-unlock-alt'">
		<form class="pure-box form-horizontal" method="POST" action="<base:url href='actions/account-crud/mamager/enable.json'/>">
			<dd>
				<input type="hidden" name="id" />
				<div class="spacer-right">
					<div class="form-group">
						<div class="col-md-3 control-label">账号</div>
						<div class="col-md-9 control-input"><input class="x-textbox" type="text" name="userCode" data-options="readonly:true"/></div>
					</div>
					<div class="form-group">
						<div class="col-md-3 control-label">用户名</div>
						<div class="col-md-9 control-input"><input class="x-textbox" type="text" name="displayName" data-options="readonly:true"/></div>
					</div>
				</div>
				<div class="text-center color-warn"> 确定解锁该账号? </div>
			</dd>
		</form>
		<div class="dialog-button">
			<a href="javascript:void(0)" class="x-linkbutton" data-options="xaction:'submit',iconCls:'fa fa-check',message:'解锁'">确定</a>
			<a href="javascript:void(0)" class="x-linkbutton" data-options="xaction:'close',iconCls:'fa fa-close'">取消</a>
		</div>
	</div>
	<div class="x-dialog container-fluid" title="锁定" data-options="xpopup:'disable',width:320,modal:true,iconCls:'fa fa-lock'">
		<form class="pure-box form-horizontal" method="POST" action="<base:url href='actions/account-crud/mamager/disable.json'/>">
			<dd>
				<input type="hidden" name="id" />
				<div class="spacer-right">
					<div class="form-group">
						<div class="col-md-3 control-label">账号</div>
						<div class="col-md-9 control-input"><input class="x-textbox" type="text" name="userCode" data-options="readonly:true"/></div>
					</div>
					<div class="form-group">
						<div class="col-md-3 control-label">用户名</div>
						<div class="col-md-9 control-input"><input class="x-textbox" type="text" name="displayName" data-options="readonly:true"/></div>
					</div>
				</div>
				<div class="text-center color-warn"> 确定锁定该账号? </div>
			</dd>
		</form>
		<div class="dialog-button">
			<a href="javascript:void(0)" class="x-linkbutton" data-options="xaction:'submit',iconCls:'fa fa-check',message:'锁定'">确定</a>
			<a href="javascript:void(0)" class="x-linkbutton" data-options="xaction:'close',iconCls:'fa fa-close'">取消</a>
		</div>
	</div>
	<div class="x-dialog container-fluid" title="重置密码" data-options="xpopup:'password',width:500,modal:true,iconCls:'fa fa-lock'">
		<form class="pure-box form-horizontal" method="POST" action="<base:url href='actions/account-crud/mamager/password.json'/>">
			<dd>
				<input type="hidden" name="id" />
				<div class="spacer-right">
					<div class="form-group">
						<div class="col-md-3 control-label">账号</div>
						<div class="col-md-9 control-input"><input class="x-textbox" type="text" name="userCode" data-options="readonly:true"/></div>
					</div>
					<div class="form-group">
						<div class="col-md-3 control-label">用户名</div>
						<div class="col-md-9 control-input"><input class="x-textbox" type="text" name="displayName" data-options="readonly:true"/></div>
					</div>
					<div class="form-group">
						<div class="col-md-3 control-label"><i class="asterisk"></i>输入新密码</div>
						<div class="col-md-9 control-input"><input class="x-textbox" type="text" name="password" data-options="required:true,validType:'length[0,50]'"/></div>
					</div>
				</div>
			</dd>
		</form>
		<div class="dialog-button">
			<a href="javascript:void(0)" class="x-linkbutton" data-options="xaction:'submit',iconCls:'fa fa-check',message:'重置密码'">确定</a>
			<a href="javascript:void(0)" class="x-linkbutton" data-options="xaction:'close',iconCls:'fa fa-close'">取消</a>
		</div>
	</div>
	<div class="toolbar-box">
		<form class="toolbar-collapse">
			<div class="panel-tool">
				<a href="javascript:void(0)" class="accordion-collapse accordion-expand"></a>
			</div>
			<div class="toolbar-item">
				<input type="hidden" name="deptCodeStarts" />
				<span class="toolbar-text">用户账号:</span><input type="text" name="userCodeLike" class="x-textbox panel-input"/>
				<span class="toolbar-text">电话:</span><input type="text" name="phoneStarts" class="x-textbox panel-input"/>
				<div class="clear"></div>
			</div>
			<div class="toolbar-item">
				<a href="javascript:void(0)" class="x-linkbutton" data-options="xaction:'search',iconCls:'fa fa-search'">查询</a>
				<a href="javascript:void(0)" class="x-linkbutton" data-options="xaction:'reset'<%--,iconCls:'fa fa-circle-thin'--%>">重置</a>
			</div>
			<div class="toolbar-more" style="width:650px;">
				<div class="toolbar-item">
					<span class="toolbar-text">真实姓名:</span><input name="realNameLike" class="x-textbox panel-input"/>
					<span class="toolbar-text">邮箱:</span><input name="emailLike" class="x-textbox panel-input"/>
				</div>
				<div class="toolbar-item">
					<span class="toolbar-text">身份证号:</span><input name="identityLike" class="x-textbox panel-input"/>
					<%-- <span class="toolbar-text">|</span> --%>
					<span class="toolbar-text">性别:</span><input class="x-combobox panel-input" name="gender" data-options="editable:false,xextra:{field:'Gender',prepend:{key:'',value:'全部'}}"></input>
					<span class="toolbar-text">用户状态: </span><input class="x-combobox panel-input" name="userState" data-options="editable:false,xextra:{field:'UserState',prepend:{key:'',value:'全部'},ignore:['UNACTIVATED','LOGOFF']}"></input>
				</div>
				<div class="clear"></div>
			</div>
			<div class="toolbar-item">
				<%-- <a href="javascript:void(0)" class="x-linkbutton" data-options="xpopup:'details',selection:'single',iconCls:'fa fa-file-text-o'">详情</a> --%>
				<shiro:hasPermission name="account-crud:mamager:create">
				<a href="javascript:void(0)" class="x-linkbutton" data-options="xpopup:'create',iconCls:'fa fa-plus',fillData:false,onAfterFillData:onCreateFillData">创建</a>
				</shiro:hasPermission>
				<shiro:hasPermission name="account-crud:mamager:update">
				<a href="javascript:void(0)" class="x-linkbutton" data-options="xpopup:'update',selection:'single',iconCls:'fa fa-pencil'">修改</a>
				</shiro:hasPermission>
				<shiro:hasPermission name="account-crud:mamager:delete">
				<a href="javascript:void(0)" class="x-linkbutton" data-options="xpopup:'delete',selection:'multi',iconCls:'fa fa-minus',fillData:{id:'ids',i:'.records'}">删除</a>
				</shiro:hasPermission>
				<shiro:hasPermission name="account-crud:mamager:disable">
				<a href="javascript:void(0)" class="x-linkbutton" data-options="xpopup:'disable',selection:'single',enableWith:{userState:'NORMAL'},iconCls:'fa fa-lock'">锁定</a>
				</shiro:hasPermission>
				<shiro:hasPermission name="account-crud:mamager:enable">
				<a href="javascript:void(0)" class="x-linkbutton" data-options="xpopup:'enable',selection:'single',enableWith:{userState:'LOCKED'},iconCls:'fa fa-unlock-alt'">解锁</a>
				</shiro:hasPermission>
				<shiro:hasPermission name="account-crud:mamager:password">
				<a href="javascript:void(0)" class="x-linkbutton" data-options="xpopup:'password',selection:'single',iconCls:'fa fa-key'">重置密码</a>
				</shiro:hasPermission>
				<shiro:hasPermission name="account-crud:mamager:import">
				<%-- <a href="javascript:void(0)" class="x-linkbutton" data-options="xpopup:'import',iconCls:'fa fa-sign-in'">导入</a> --%>
				</shiro:hasPermission>
				<shiro:hasPermission name="account-crud:mamager:export">
				<%-- <a href="javascript:void(0)" class="x-linkbutton" data-options="xpopup:'export',iconCls:'fa fa-sign-out'">导出</a> --%>
				</shiro:hasPermission>
			</div>
			<div class="clear"></div>
		</form>
	</div>
</div>

<script src="<base:url href='assets/${pv.view}.js'/>"></script>
